#ifndef __KB_H__
#define __KB_H__
#include "statement.h"

typedef struct _kb KB;

KB* kb_new();
KB* kb_from_file(const char* filename);
int kb_save(KB* kb);
int kb_save_to(KB* kb, const char* filename);


int kb_insert(KB* kb, Statement* stmt);
int kb_get(KB* kb, Statement* mask, Statement** result);
int kb_delete(KB* kb, Statement* mask);

typedef (void)(*kb_subscriber)(void* data, Statement* news);

int kb_subscribe(KB* kb, kb_subscriber sc, void* data);
int kb_unsubscribe(KB* kb, kb_subscriber sc, void* data);

#endif
